home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_vol_mp1-openingroom.cog < prev    next >
Text File  |  1999-11-15  |  7KB  |  275 lines

  1. # Jones 3D Cog Script
  2. #
  3. # VOL_MP1-2Wall Blaster.cog
  4. #
  5. # an all-purpose cog for the IMP#1 effect on 2 walls
  6. #
  7. # [CMG]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.  
  14. #    MESSAGES
  15. message     startup
  16. message     activated
  17. message        damaged
  18. message        entered
  19. message        pulse
  20.  
  21. #    ACTORS
  22. thing    player                                        local
  23.  
  24. #    CAMERAS
  25. thing       offsetCam
  26.     
  27.  
  28. #    THINGS
  29. thing       bombpos            
  30. thing        fragment                                local
  31. thing        dustthing                                local
  32.  
  33. #    SURFACES
  34. surface        crackedwall        mask=0x408
  35. surface        crackedwall1    mask=0x408
  36.  
  37. surface        speaksurf    
  38.  
  39. #    MATERIALS
  40. material    dustmat=gen_a4sfx_dustcloud.mat            local
  41.  
  42.  
  43. #    SOUND FX
  44. sound        explosion=imp1_wall_break.wav            local
  45. sound       sfxCharge=imp1_chargeup.wav             local
  46. sound       mus_Eerie=mus_gen_eerie1.wav            local
  47.  
  48.  
  49. # ** voice lines **
  50. sound       inCrumble=Inxj025.wav                   local   # ...ready to crumble.
  51. sound       inVibrate=Inxj026.wav                   local   # A little vibration...
  52.  
  53.  
  54. #    TEMPLATES
  55. template    debris=stoneshrapa_nc                    local
  56. template    bomb=ghost                                local
  57. template    dust=dustcloud4ever                        local
  58.  
  59. #    VARIABLES AND VECTORS
  60.  
  61. int         saidIt=0                                local
  62. int            i=0                                           local
  63. int         done=0                                  local
  64. int         playing=0                               local
  65. flex        vibeline                                local
  66.  
  67.  
  68. vector        duststart                                  local
  69. vector        dustend                                    local
  70. vector      playervec                                 local
  71. vector      playery                                    local
  72. vector      playerx                                    local
  73.  
  74. end
  75.  
  76. # ========================================================================================
  77. code
  78. startup:
  79.     
  80.     
  81.     player = GetLocalPlayerThing();
  82.     Sleep(.3);
  83.     ClearAdjoinFlags(crackedwall, 2);
  84.     ClearAdjoinFlags(crackedwall1, 2);
  85.     ClearAdjoinFlags(GetSurfaceAdjoin(crackedwall), 2);
  86.     ClearAdjoinFlags(GetSurfaceAdjoin(crackedwall1), 2);
  87.     SetFaceGeoMode(crackedwall, 4);
  88.     SetFaceGeoMode(crackedwall1, 4);
  89.     duststart    = VectorSet(0.2, 0.2, 0.5);
  90.     dustend    = VectorSet(1.2, 1.2, 0.0);
  91.  
  92. return;
  93.  
  94. # ========================================================================================
  95. activated:
  96.     
  97.  
  98.     if((GetSenderRef() == crackedwall) && (done == 0) && (playing == 0))
  99.     {
  100.         # player activated with an IMP part so bail out
  101.         if((GetCurWeapon(player) >= 14) && (GetCurWeapon(player) <= 18)) return;
  102.         
  103.         # player activated with lighter
  104.         else if(GetCurWeapon(player) == 13)
  105.         {
  106.             playing = 1;
  107.             
  108.             # put away the lighter
  109.             DeselectWeapon(player);
  110.             DeselectWeaponWait(player);
  111.             
  112.             Call vibeLine;
  113.         }
  114.         
  115.         # normal activation
  116.         else
  117.         {
  118.             playing = 1;
  119.             
  120.             # wait for weapon to be put away
  121.             DeselectWeaponWait(player);
  122.             
  123.             Call vibeLine;
  124.         }
  125.     }   
  126.  
  127.     return;
  128.     
  129. # ========================================================================================
  130. damaged:
  131.     
  132.     if((GetParam(1) == 0x1000) && (done == 0))
  133.     {
  134.         done = 1;
  135.         
  136.         # do cutscene stuff
  137.         MakeMeStop();
  138.         StartCutscene(1);
  139.         
  140.         # interp camera
  141.         SetExtCamOffsetToThing(offsetCam);
  142.         
  143.         # start cameraShake
  144.         SetPulse(0.05);
  145.        
  146.         # alter fov for zoom-in effect
  147.         SetCameraFOV(70, 1, 2.5);
  148.         
  149.         # play temp sfx
  150.         PlaySoundLocal(sfxCharge, 1.0, 0.0, 0x0, 0);
  151.         
  152.         # light up the player
  153.         SetThingLight(bombpos, '0.25 0.55 1.0', 5.0, 2.0);
  154.         Sleep(1.0);
  155.  
  156.         # play explosion sfx
  157.         PlaySoundLocal(explosion, 1, 0, 0x0, 0);
  158.         
  159.         Sleep(1.0);
  160.         
  161.         # reset fov
  162.         ResetCameraFOV(0, 0.0);
  163.         
  164.         # kill dynamic light
  165.         SetThingLight(bombpos, '0.0 0.0 0.0', 5.0, 2.0);
  166.         
  167.         
  168.         # create the debris
  169.         for(i=0; i<8; i=i+1)                                                                        
  170.         {
  171.         fragment = CreateThing(debris, bombpos);                                 
  172.         SetThingVel(fragment, VectorScale(VectorAdd(RandVec(), '-0.5 -0.1 0.0'), 1));
  173.         SetThingRotVel(fragment, VectorScale(VectorAdd(RandVec(), '0.0 0.0 0.0'), 200.0));
  174.         Sleep(0.025);
  175.         }
  176.         
  177.         # alter adjoins
  178.         SetAdjoinFlags(crackedwall, 2);
  179.         SetAdjoinFlags(GetSurfaceAdjoin(crackedwall), 2);
  180.         SetAdjoinFlags(crackedwall1, 2);
  181.         SetAdjoinFlags(GetSurfaceAdjoin(crackedwall1), 2);
  182.  
  183.         SetFaceGeoMode(crackedwall, 0);
  184.         SetFaceGeoMode(crackedwall1, 0);
  185.         
  186.         # stop the screenshake
  187.         SetPulse(0);
  188.  
  189.         # create and animate the dust sprite
  190.         SetMaterialCel(dustmat, 0);
  191.         MaterialAnim(dustmat, 8.0, 1);
  192.         dustthing = CreateThing(dust, bombpos);
  193.         AnimateSpriteSize(dustthing, duststart, dustend, 7.0);
  194.         
  195.         # rest for a bit
  196.         Sleep(0.5);
  197.         
  198.         # restore camera
  199.         SetCameraPosition(1, GetThingPos(offsetCam));
  200.         SetCurrentCamera(1);
  201.         
  202.         # restore controls
  203.         RestoreExtCam();
  204.         ResetCameraFOV(0, 0.0);
  205.         EndCutscene();
  206.         ClearActorFlags(player, 0x200000);
  207.         
  208.         # play music cue (temp?)
  209.         PlaySoundLocal(mus_Eerie, 1.0, 0.0, 0x0, 0);
  210.     }
  211.  
  212. return;
  213.     
  214. # ========================================================================================
  215. entered:
  216.  
  217.     player = GetLocalPlayerThing();
  218.     playervec = GetThingLVec(player);
  219.     playery = VectorY(playervec);
  220.     playerx = VectorX(playervec);
  221.  
  222.     if((GetSenderRef() == speaksurf) && (saidIt == 0))
  223.     {
  224.         if ((playerx < 0) && ((playery > -0.7) && (playery < 0.7)))     # west
  225.         {
  226.             saidIt = 1;
  227.             PlayVoice(player, inCrumble, 1.0, 1);
  228.         }
  229.     }
  230.     
  231.     return;
  232.  
  233.  
  234. # ========================================================================================
  235. vibeLine:
  236.  
  237.     # do cutscene stuff
  238.     MakeMeStop();
  239.     StartCutscene(0);
  240.     
  241.     # interp camera
  242.     SetExtCamOffsetToThing(offsetCam);
  243.     
  244.     # activate face and say line
  245.     PlayMode(player, 60, 0);
  246.     Sleep(0.3);
  247.     PlayVoice(player, inVibrate, 1.0, 1);
  248.     
  249.     # restore controls and camera
  250.     RestoreExtCam();
  251.     
  252.     EndCutscene();
  253.     ResetCameraFOV(0, 0.0);
  254.     ClearActorFlags(player, 0x200000);
  255.     
  256.     playing = 0;
  257.     
  258.     return;
  259.  
  260. # ========================================================================================
  261. pulse:
  262.  
  263.     
  264.         SetPOVShake('0.0 0.0 0.001', '0.0 0.0 0.0', 80.0, 0.80);
  265.     return;
  266.  
  267. # ========================================================================================
  268.  
  269.  
  270. end
  271.  
  272.  
  273.  
  274.  
  275.